#include <stdio.h>
#include <iostream>
using namespace std;
#pragma once
#include "global.h"
/*
TODO:
Make the player spawn an item rather than a tile!

Item definitions:
0: health pickup.
1: ammo pickup.
2: Tower upgrade.
3: mystery crate.
4: Zombie path node.
5: 
*/

class Item
{
public:
	int x,y,w,h,id,type,health;
	bool active;
	void Create(int x_, int y_,int type_)
	{
		active=true;
		x=x_;
		y=y_;
		type=type_;
		cout << "******ITEM CREATED..." <<endl;
		cout << "# id: " << type <<endl;
		cout << "# x: " << x <<endl;
		cout << "# y: " << y <<endl;
	}
	void collision(int x,int y,int w,int h)
	{

	}
	void Process()
	{
		//check collisions and stuff.
		//if(health<=0){Destroy();}
	}
	void Destroy()
	{
		//drop item or whatever it's function is
		active=false;
	}
};

class itemHandle
{

public:
	static const int MAX_ITEMS = 255;
	Item items[MAX_ITEMS];
	int addItem(int x, int y, int type)
	{
		for(int i=0; i<MAX_ITEMS; i++)
		{
			if(items[i].active!=true)
			{
				items[i].Create(x,y,type);
				return 1;
			}
		}
			return 0;

	}
	void removeItem(int id)
	{
		items[id].Destroy();
	}
};

